/**********************************************************************
 Copyright (C) 2011 Jaakko Vuori

 This file is part of ShredMate.
 For more information, see <http://code.google.com/p/shredmate/>

 ShredMate is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation, either version 3 of the License, or
 (at your option) any later version.

 ShredMate is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with ShredMate.  If not, see <http://www.gnu.org/licenses/>.
 **********************************************************************/

#ifndef PCMGENERATOR_H
#define PCMGENERATOR_H

#include <QIODevice>
#include "shredmateengine_global.h"

class SHREDMATEENGINESHARED_EXPORT PCMGenerator : public QIODevice
{
    Q_OBJECT

public:
    explicit PCMGenerator(QObject *parent = 0);
    ~PCMGenerator();

    void setData(const char* data, qint64 length);
    qint64 bufferLength() const;

signals:
    void ended();

protected:
    qint64 readData(char* data, qint64 maxlen);
    qint64 writeData(const char* data, qint64 len);

private:
    const char* m_data;
    qint64 m_length;
    qint64 m_currentPosition;
    bool m_looping;

    friend class ShredmateEngine;
};

#endif // PCMGENERATOR_H
